package com.victor.bookretail.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.victor.bookretail.domain.OrderInfoBo;
import lombok.Data;

import java.math.BigDecimal;

@Data
@TableName(value = "order_info")
public class OrderInfoPo {

    @TableId(type = IdType.AUTO)
    private Long id;

    private Long userId;

    private BigDecimal amount;

    public static OrderInfoPo fromBo(OrderInfoBo bo) {
        OrderInfoPo po = new OrderInfoPo();
        po.setUserId(bo.getUserId());
        po.setAmount(bo.getAmount());
        return po;
    }

    public OrderInfoBo toBo() {
        OrderInfoBo bo = new OrderInfoBo();
        bo.setUserId(this.userId);
        bo.setAmount(this.amount);
        return bo;
    }

}
